//


#import "NT_DeleTableViewCell.h"

//
@interface NT_DeleTableViewCell ()
/** tubiao*/
@property (nonatomic, strong) UIImageView *IMG;
/** biaoti */
@property (nonatomic, strong) UILabel *titleLabel;
/** shijian */
@property (nonatomic, strong) UILabel *dateLabel;

@end

@implementation NT_DeleTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //
        self.IMG =  ({
            UIImageView *img = [[UIImageView alloc]init];
            [self.contentView addSubview:img];
            img;
        });
        self.titleLabel = ({
            UILabel *label = [[UILabel alloc]init];
            label.textColor = rgba(60, 60, 60, 1);
            label.font = FontPFRegular(kRelativeWidth(18));
            label.text = @"";
            [self.contentView addSubview:label];
            label;
        });
        self.dateLabel = ({
            UILabel *label = [[UILabel alloc]init];
            label.textColor = rgba(90, 90, 90, 1);
            label.font = FontPFRegular(kRelativeWidth(14));
            label.text = @"";
            [self.contentView addSubview:label];
            label;
        });
        
    }
    return self;
}


- (void)setNeedsLayout {
    [super setNeedsLayout];
    
    [self.IMG mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(kRelativeHeight(10));
        make.left.mas_offset(kRelativeWidth(12));
        make.width.height.mas_equalTo(kRelativeWidth(50));
    }];
    [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(kRelativeHeight(10));
        make.left.mas_equalTo(self.IMG.mas_right).offset(kRelativeWidth(20));
        make.right.mas_offset(-kRelativeWidth(40));
        make.height.mas_equalTo(kRelativeWidth(25));
    }];
    [self.dateLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(kRelativeHeight(10));
        make.left.mas_equalTo(self.titleLabel);
        make.height.mas_equalTo(kRelativeHeight(20));
    }];
    
}

- (void)setModel:(DeleData *)model {
    _model = model;
    
    self.titleLabel.text = model.title;
    self.dateLabel.text = model.date;
    self.IMG.image = (UIImage*)model.img;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
